//
//  QKUserAccountViewModel.h
//  QKWeibo-OC
//
//  Created by iMac_Kurt on 16/8/20.
//  Copyright © 2016年 Kurt_Qi. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "QKUserAccount.h"

@interface QKUserAccountViewModel : NSObject 

/// 模型属性
@property (nonatomic, strong) QKUserAccount *account;
/// 用户头像URL
@property (nonatomic, strong) NSURL *avatarURL;
/// accessToken
@property (nonatomic, copy) NSString *accessToken;
/// 处理用户状态：判断是否登录
@property (nonatomic, assign, readonly, getter = userLogon) BOOL state;
/// 处理accessToken时限：判断是否过期
@property (nonatomic, assign, readonly, getter = isExpired) BOOL accessTokenTimeLimit;

/// 创建视图模型单例
///
/// @return QKUserAccountViewModel
+ (instancetype)sharedUserAccount;

/// 封装获取token的网络方法
///
/// @param code     授权码
/// @param finished 完成的回调
- (void)loadAccessToken:(NSString *)code finished:(void(^)(BOOL isSuccessed))finished;
@end
